#!/bin/sh
#

set -e

# Initialize the $iraf and environment.
if [ -z "$iraf" ]; then
  if [ -e "$HOME/.iraf/setup.sh" ]; then
    . "$HOME/.iraf/setup.sh"
  else
    . unix/hlib/setup.sh
  fi
else
    . "$iraf/unix/hlib/setup.sh"
fi


cd "$iraf/"				# build core system
mkpkg -x

cd "$iraf/noao"				# build NOAO package
export noao=$(pwd)/
mkpkg -x -p noao

cd "$iraf/vo"				# build VO package
export vo=$(pwd)/
mkpkg -x -p vo
